Skip to content

[PHP] vfs: report truthful per-object path configuration#752

Merged
brandonpayton merged 1 commit into
integration/kd-6nz-php-phpt-platform-fixesfrom
gascity/kd-6nz/split-pr717-pathconf-constants
Jul 11, 2026
Merged

[PHP] vfs: report truthful per-object path configuration#752
brandonpayton merged 1 commit into
integration/kd-6nz-php-phpt-platform-fixesfrom
gascity/kd-6nz/split-pr717-pathconf-constants

Conversation

@brandonpayton

@brandonpayton brandonpayton commented Jun 20, 2026

Copy link
Copy Markdown
Member

Purpose

Make pathconf() and fpathconf() report the limits and capabilities of the object actually named or opened. The original patch aligned a few numeric constants and returned static answers from libc; it did not preserve POSIX indeterminate results, consult the mounted backend or live open-file description, validate guest output ranges, or define the host/kernel ABI.

Review of the original PR

The original one-commit head f975ced was not acceptable to land:

  • pathconf and fpathconf were static libc-side tables rather than platform behavior;
  • successful -1 results could not be distinguished from errors through errno;
  • file-descriptor queries did not survive rename or unlink through the live OFD;
  • namespace, device, procfs, terminal, pipe, socket, memfd, host, memory, and OPFS behavior was not represented;
  • the syscall descriptors and guest-pointer contract were absent; and
  • no truthful ABI or real-browser evidence accompanied the change.

Replacement made during review

The replacement commit 95c34d8 (tree cb2949e1a) was rebuilt on the exact Batch 2 tip a71015b.

  • Active musl wrappers now call syscalls 112 and 113 with a status plus 64-bit output, preserving a successful indeterminate -1 without changing errno.
  • Shared pathconf names, syscall descriptors, required-pointer metadata, generated TypeScript constants, and ABI snapshot evidence are centralized.
  • Generic host marshalling validates guest ranges, aligns scratch storage to eight bytes, and returns EFAULT instead of throwing.
  • pathconf resolves the live namespace and mounted backend; fpathconf uses the live OFD/backend handle, including open-after-unlink behavior.
  • NAME_MAX is enforced as 255 bytes and PATH_MAX as 4096 bytes including the terminating NUL. Caller path and symlink-substitution limits are enforced without incorrectly charging an internal deep-CWD prefix.
  • Regular files, directories, memfd, procfs/devfs, synthetic /etc/mtab, terminal descriptors, pipes, sockets, host files, memory files, and OPFS return object-specific values or an intentional indeterminate result.
  • Terminal limits come from live termios state; unbounded canonical/input queues are indeterminate and _POSIX_VDISABLE is zero.
  • OPFS stat now uses FileSystemFileHandle.getFile().size so pathconf and stat remain usable while a synchronous access handle is already open.
  • Public root, browser, and VFS entrypoints export the new pathconf contract, and POSIX/ABI documentation records the supported behavior and boundaries.

Known boundary

Host-captured stdio reports PIPE_BUF as indeterminate. The guest header still promises PIPE_BUF=4096, so that host-backed boundary remains documented rather than claimed as fully reconciled. Many other optional values are intentionally indeterminate. Performance was not measured.

ABI status

The snapshot, generated TypeScript, and headers are synchronized on this branch, but the exact-base same-version classifier intentionally reports an incompatible change: required host_pathconf/host_fpathconf imports, changed kernel export signatures, and new syscall descriptor semantics. This commit is acceptable only inside the unmerged #871 quarantine. After all constituents are present, #871 must rebase onto live main and perform its one atomic ABI version reconciliation and artifact rebuild. This PR does not claim standalone ABI compatibility or readiness for main.

Validation on the exact replacement tree

  • aarch64 kernel library suite: 1,124/1,124 passed.
  • Shared crate: 19/19 passed.
  • ABI generator/classifier unit tests: 12/12 passed.
  • Focused host/pathconf/VFS tests: 56/56 passed.
  • Host ESM, CJS, and declaration builds passed.
  • Fresh wasm32 and wasm64 musl builds passed; raw wasm32 and wasm64 pathconf guests passed.
  • Canonical scripts/dev-shell.sh bash build.sh completed successfully.
  • Fresh PHP package build completed; PHP artifact SHA-256 is 28fe4a6f8a13a9d8828ce05cd127008286318d7fea18c780783c319607a27bfb.
  • Upstream ext/posix posix_pathconf.phpt and posix_fpathconf.phpt passed 2/2 in Node and 2/2 in real Chromium.
  • Isolated Chromium pathconf, OPFS pathconf, and OPFS seek coverage passed 3/3.
  • Canonical ./run.sh browser resolved 66/66 enabled artifacts, reached Vite, and the focused pathconf plus OPFS Chromium specs passed 2/2 against that live server.
  • git diff --check was clean.
  • The expected incompatible ABI classification is recorded above; it is not represented as a passing ABI gate.

The full host/libc/POSIX/Sortix/full-PHPT aggregate gate has not been run for this constituent under the agreed batching contract.

Recommendation

Accept this replacement into #871 only. It fixes the platform contract exposed by PHP instead of special-casing PHP, has exact Node/browser evidence, and keeps its incompatible ABI delta quarantined for the aggregate reconciliation.

Resolve pathconf and fpathconf against the live namespace, backend, and open-file handle instead of static libc answers. Preserve indeterminate -1 results without changing errno, validate guest pointers, and generate shared names and descriptors.

Enforce byte-based NAME_MAX and PATH_MAX at namespace boundaries, expose terminal values from live termios state, and keep OPFS stat compatible with already-open sync handles. Add focused wasm32, wasm64, host, kernel, Node, and Chromium coverage.

This changes required host imports and kernel export signatures. It is intentionally confined to the unmerged Batch 2 integration branch pending its single post-rebase ABI version reconciliation.
@brandonpayton brandonpayton force-pushed the gascity/kd-6nz/split-pr717-pathconf-constants branch from f975ced to 95c34d8 Compare July 11, 2026 22:16
@brandonpayton brandonpayton changed the title [PHP] fix: align pathconf constants with libc [PHP] vfs: report truthful per-object path configuration Jul 11, 2026
@brandonpayton brandonpayton changed the base branch from integration/kd-6nz-php-phpt-harness-only-base to integration/kd-6nz-php-phpt-platform-fixes July 11, 2026 22:17
@brandonpayton brandonpayton merged commit f634631 into integration/kd-6nz-php-phpt-platform-fixes Jul 11, 2026
@brandonpayton brandonpayton deleted the gascity/kd-6nz/split-pr717-pathconf-constants branch July 11, 2026 22:17
brandonpayton added a commit that referenced this pull request Jul 13, 2026
Pathconf return conventions, 64-bit output storage, syscall marshalling, the required host surface, errno behavior, and live-object interpretation change existing ABI semantics. Advance ABI 33 to 34 and regenerate ABI evidence atomically.

Source-PR: #752
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant